<template>
  <div id="PutMange">
    <div class="filterQuery">
      <div class="tiao">
        <span class="label">投放状态：</span>
        <el-radio-group v-model="radio" size="small">
          <el-radio-button label="">全部</el-radio-button>
          <el-radio-button label="1">待投放</el-radio-button>
          <el-radio-button label="2">已投放</el-radio-button>
          <!-- <el-radio-button label="审核中"></el-radio-button>
          <el-radio-button label="打回修改"></el-radio-button>
          <el-radio-button label="审核通过"></el-radio-button>
          <el-radio-button label="无效"></el-radio-button> -->
        </el-radio-group>
      </div>
    </div>
    <div class="putCon">
      <div class="table">
        <el-table :data="tableData" border style="width: 100%">
          <el-table-column prop="batch" label="投放批次" width="180" align="center"></el-table-column>
          <el-table-column prop="supplyNum" label="供应商数量" width="180" align="center"></el-table-column>
          <el-table-column prop="receiveAmount" label="应收账款金额" align="center"></el-table-column>
          <el-table-column prop="total" label="计划投放总额" align="center"></el-table-column>
          <el-table-column prop="deplayDate" label="计划投放日期" align="center"></el-table-column>
          <el-table-column prop="requestDate" label="提交日期" align="center"></el-table-column>
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-button type="primary" size="mini" @click="shenhe(scope.row)">审核</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="block">
          <el-pagination
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="10"
          layout="total, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
        </div>
      </div>
    </div>
    <!-- -------------------------- -->
  </div>
</template>

<script>
export default {
  name: "PutMange",
  data() {
    return {
      radio: "",
      options: [
        {
          value: "选项1",
          label: "黄金糕"
        },
        {
          value: "选项2",
          label: "双皮奶"
        },
        {
          value: "选项3",
          label: "蚵仔煎"
        },
        {
          value: "选项4",
          label: "龙须面"
        },
        {
          value: "选项5",
          label: "北京烤鸭"
        }
      ],
      tableData: [],
      value: "",
      diaSelvalue: "",
      currentPage: 1,
      total: null
    };
  },
  mounted() {
    this.getdata(1);
  },
  methods: {
    shenhe(row) {
      this.axios.post('AdminAPI/marketProject/deployMarketProject',{projectId: sessionStorage.getItem("swdypId")-0, batch: row.batch})
        .then(({data})=> {
          if (data.code == 200) {
             this.$message({message: '发布成功',type: 'success'});
          }
        })
    },
    getdata(val) {
      let obj = {
        projectId: sessionStorage.getItem("swdypId"),
        state: this.radio,
        page: this.currentPage
      };
      this.axios
        .get("AdminAPI/marketProject/getMarketProjectList", {
          params: this.filterNoneObj(obj)
        })
        .then(({ data }) => {
          this.tableData = data.data.dataList;
          this.total = data.pageInfo.total;
        });
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getdata(val);
    },
    jianli() {
      this.dialogVisible = true;
    }
  },
  watch: {
    radio:function() {
      this.getdata(1);
    }
  }
};
</script>

<style lang="scss">
#PutMange {
  background: white;
  .filterQuery {
    margin-top: 10px;
    background: #e2eefd;
    padding-left: 34px;
    position: relative;
    .tiao {
      padding: 10px 0;
      .label {
        font-size: 20px;
        vertical-align: middle;
        color: #333333;
      }
      .el-radio-button__inner {
        border: none;
        padding: 6px 15px;
        background: none;
        font-size: 18px;
        border-radius: 0;
        margin-right: 15px;
      }
      .el-radio-button {
        &.is-active {
          span {
            background-color: #409eff !important;
          }
        }
      }
    }
  }
  .putCon {
    padding: 0 74px;
    .tipCon {
      display: flex;
      justify-content: space-between;
      margin: 25px 0;
      .firstSpan {
        margin-right: 50px;
      }
    }
  }
  .table {
    padding-top: 30px;
    background: white;
    .has-gutter tr th {
      background: #fefaf1;
    }
    .block {
      text-align: right;
      margin-right: 55px;
      height: 50px;
      margin-top: 20px;
    }
  }
  .diasel {
    display: flex;
    justify-content: center;
    border-bottom: 1px solid rgba(185, 185, 185, 1);
    .el-select {
      position: relative;
      transform: translateY(-60%);
    }
  }
  .blueT {
    font-size: 18px;
    color: rgba(30, 124, 240, 1);
    margin: 18px 0;
  }
  .has-gutter tr th {
    background: #fefaf1;
  }
  .diabtn {
    text-align: center;
    margin: 20px;
  }
}
</style>
